<?php

/**
  +---------------------------------------<br/>
 * 控制器:刮刮卡<br/>
  +---------------------------------------
 * @category membership
 * @package web.front.action
 * @author jason 
 */
class Action_Scratchcard extends Action {
	
	public function index(){
      $this->loadCss("resources/css/scratchcard.css");
      $this->loadJs("js/wScratchPad.js"); 
      $this->loadJs("js/scratchcard.js"); 
		  $openid = isset($_GET['openid']) ? $_GET['openid'] : 0;
      HttpSession::set("openid", $openid);
      $data = Scratchcard::get_one("weixin='".$openid."'");
      $jifen = 0;
      $num = 0;
      $strdate = "2014-09-15";
      $sotdate = "2014-09-25";
      if (!$data) {
          srand((float) microtime() * 10000000);
          $input = array(0=>"一等奖",1=>"二等奖",2=>"三等奖",3=>"二等奖",4=>"三等奖",5=>"三等奖");
          $rand_keys = array_rand($input,1);
          $jifen = $input[$rand_keys];
          $num = 1;
      }
      $this->view->set("jifen",$jifen);
      $this->view->set("num",$num);
      $this->view->set("strdate",$strdate);
      $this->view->set("sotdate",$sotdate);
      $this->view->set("data",$data);
      $this->view->set("site_name","刮刮卡中心");
	}

  public function ajaxAdd(){
      
  }
  
}